<?php include_once './application/views/sys_admin/common/header.php';  ?>
<!-- admin_main -->
<div class="admin_main">
	<!-- Admin_top end -->
	<?php include_once './application/views/sys_admin/common/user_left.php';  ?>
	<!-- Admin_Left End -->
	<div class="admin_right">
	<div class="admin_right_title"  style="margin-bottom:10px;"><strong>用户管理</strong> >> 客户证明资料管理</div>
	
		<a class="addtr" href="/sys_admin/user/data_upload" >资料代传</a>	
		<div class="admin_right_con" style="width: 98%">
			
			<table border="0" cellspacing="1" cellpadding="0" bgcolor="#f0f0f0" width="100%">
			  <tr style="color:#636363;">
				<td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong>ID</strong></td>
				<td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong>用户名</strong></td>
				<td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong>真实姓名</strong></td>
				<td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong>所属客服</strong></td>
				<td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong>资料类型</strong></td>
				<td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong>图片</strong></td>
				<td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong>获得积分</strong></td>
				<td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong>状态</strong></td>
				<td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong>上传时间</strong></td>
				<td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong>操作</strong></td>
			  </tr>			
			  <?php foreach($list as $info){?>
			  <tr>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><?php echo $info['id'];?></td>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><?php echo $info['username'];?></td>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><?php echo $info['realname'];?></td>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><?php echo $kefu_list[$info['kefu_userid']]['username'];?></td>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><?php echo $type_list[$info['type_id']];?></td>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><a
						href="/<?php echo $info['litpic']?>" target="_blank"><img
						style="width: 60px; height: 30px;" src="/<?php echo $info['litpic']?>"
						alt="<?php echo $info['name']?>" /></a></td>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><?php echo $info['jifen'];?></td>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><?php echo $status_list[$info['fstatus']];?></td>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><?php echo date('Y-m-d',$info['add_time']);?></td>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF">
					<a href="javascript:checkattStatus(<?php echo $info['fstatus']==0?$info['id']:0; ?>);"><?php echo $info['fstatus']==0?'审核':'--'; ?></a>
					&nbsp;&nbsp;&nbsp;&nbsp;
					<?php if($info['fstatus']==0){?>
					<a href="/sys_admin/user/update_att/<?php echo $info['id'];?>">修改</a>
					&nbsp;&nbsp;&nbsp;&nbsp;
					<?php }?>
					
					<a href="javascript:void(0);" onclick="javascript:del('<?php echo $info['id'];?>');">删除</a>
				</td>
			  </tr>
			  <?php }?>
			  <tr>
			  	<td colspan="12" align="right" bgcolor="#FFFFFF">
			  		<form action="" method="get">
			  			用户名：<input type="text" id="username" name="username" value="<?php echo $parms['username'];?>" />
			  			所属客服：<select name="kefu_userid">
									<option value="0">请选择客服</option>
									<?php foreach($kefu_list as $val){ ?>
									<option value="<?php echo $val['user_id'];?>" <?php if($parms['kefu_userid']==$val['user_id']) echo "selected='selected'"; ?>><?php echo $val['username'];?></option>
									<?php } ?>
									</select>
			  			状态：<select name=fstatus>
			  			<option value="-1" <?php if($parms['fstatus']==-1) echo "selected='selected'"; ?>>全部</option>
			  			<?php foreach($status_list as $k => $v) { ?>
			  			<option value="<?php echo $k; ?>" <?php if($parms['fstatus']==$k) echo "selected='selected'"; ?>><?php echo $v; ?></option>
			  			<?php } ?>
			  			</select>
			  			<input type="submit"/>
			  		</form>
			  	</td>
			  </tr>
			  <tr>
			  	<td height="35" colspan="12" align="center" class="page" bgcolor="#FFFFFF"><?php echo $this->pagination->create_links();?></td>
			  </tr>
			</table>
			</div>
	</div>
<!-- Admin_Right End -->
</div>

<div id="dialog" title="系统提示" style="display: none">
<p id="msg" style="text-align: center"></p>
</div>

<div id="attdialog" title="系统提示" style="display:none;">
<div id="attmsg" style="text-align:center;color:red">&nbsp;</div>
<input type="hidden" name="id" id="id" />
状态：<input type="radio" name="att_fstatus" checked="checked" value="1"/>审核通过  <input type="radio" name="att_fstatus" value="2"/>审核不通过 <br /> <br />
备注：<textarea  id="verify_remark" name="verify_remark" style="width: 300px;height: 100px;">证明材料审核通过</textarea><br />
<div style="text-align:center;">
<input type="button" value="关闭" onclick="$('#attdialog').dialog('close');"/>
<input type="button" value="提交" onclick="changeAtt();" />
</div>
</div>

<script>
$("input[name='att_fstatus']").bind("click", function(){
	var _att_fstatus = $("input[name='att_fstatus']:checked").val();		
	if(_att_fstatus == 2){
		$( "#verify_remark" ).val('证明材料审核不通过');
	}else{
		$( "#verify_remark" ).val('证明材料审核通过');
	}
}); 

function del(id){
	$.ajax({
		type: "get",
		url : '/sys_admin/user/del_att/'+id,
		success: function(ret){
		$('#dialog').dialog({
			modal:true,
			title:'系统提示',
			buttons:{"确定":function(){$(this).dialog("close");}},
			close: function() {
				location=ret.url;
			}
			}); 
			$("#msg").html(ret.msg);
		},
		dataType: "json"
	});	
}

function checkattStatus(id){
	if(id>0){
		$( "#attdialog" ).dialog({
			height:250,
			width:500,
			modal:true, //蒙层（弹出会影响页面大小）
			title:'证明材料审核'
		});
		
		$( "#id" ).val(id);
	}
}
function changeAtt(){
	$.ajax({
		type: "POST",
		url: "/sys_admin/user/check_att",
		data: "id="+$('#id').val()+"&fstatus="+$('input[name="att_fstatus"]:checked').val()+"&verify_remark="+$('#verify_remark').val(),
		success: function(msg){
	        $( "#attdialog" ).dialog();
			$("#attmsg").html(msg);
			setTimeout(function(){
				$("#attmsg").html("&nbsp;");
				if(msg=='操作成功'){
					location.reload();
				}
			},3000);
		},
		dataType: "text"
	});
}
</script>
<!-- admin_main end -->
</body>
</html>
